package com.cy.law.builder.web;

import com.cy.law.builder.service.BuilderService;
import com.cy.law.vo.RequestResult;
import com.cy.law.vo.Tree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("home/builder")
public class BuilderController {

    @Autowired
    BuilderService builderService;

    @RequestMapping(value = "/getHumanList", method = RequestMethod.POST)
    public List<Tree> getHumanTreeHandler() {
        return builderService.getHumanTree();
    }

    @RequestMapping(value = "/getHumanInfoByHumanId", method = RequestMethod.POST)
    public RequestResult getHumanInfoByHumanIdHandler(@RequestParam int humanId) {
        return builderService.getHumanInfoByHumanId(humanId);
    }

    @RequestMapping(value = "/getHumanRightTree", method = RequestMethod.POST)
    public List<Tree> getHumanRightTreeHandler(int humanId) {
        return builderService.getHumanRightTree(humanId);
    }

}
